add 'exclude' option to radius filter
authorparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 21 Jul 2003 21:19:02 +0000 (21:19 +0000)
committerparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 21 Jul 2003 21:19:02 +0000 (21:19 +0000)
gpsbabel/README
gpsbabel/position.c

index 3b5963aab1c64b132377637d8418bab813fe7e7e..ee13a2032810aa5540ed8791f2cc37de41e8e210 100644 (file)
@@ -402,7 +402,7 @@ DATA FILTERS
        line by passing the distance=XXX option to the filter.  Distance
        options may be expressed in feet (distance=3f) or meters 
        (distance=1m).  The default is zero feet, essentially a duplicate
-       position.
+       position.  
 
        For example:
 
@@ -420,7 +420,9 @@ DATA FILTERS
        are declared on the command line by passing the distance=X.XX,
        lat=X.XX, and lon=X.XX options to the filter.  Distance options 
        may be expressed in miles (distance=3M) or kilometers (distance=3K).
-       The default is zero miles.
+       The default is zero miles.  Additionally, the exclude option may 
+        be specified to reverse the effect of the filter, so that points 
+        further from the center are kept and closer points are discarded.
 
        For example:
 
index e83abc0b953c2f1b511e56dbcf0304e8fd77fd12..3b49670995c4a7696a804bfd8479861af31c57c3 100644 (file)
@@ -32,6 +32,7 @@ static double pos_dist;
 static char *distopt;
 static char *latopt;
 static char *lonopt;
+static char *exclopt;
 
 waypoint * home_pos;
 
@@ -50,6 +51,7 @@ arglist_t radius_args[] = {
        {"lat", &latopt,       "Latitude for center point (D.DDDDD)"},
        {"lon", &lonopt,       "Longitude for center point (D.DDDDD)"},
        {"distance", &distopt, "Maximum distance from center"},
+       {"exclude", &exclopt,  "Exclude points close to center"},
        {0, 0, 0}
 };
 
@@ -195,7 +197,7 @@ radius_process(void)
                /* convert radians to float point statute miles */
                dist = (((dist * 180.0 * 60.0) / M_PI) * 1.1516);
 
-               if (dist >= pos_dist) {
+               if ((dist >= pos_dist) == (exclopt == NULL)) {
                        waypt_del(waypointp);
                        waypt_free(waypointp);
                        continue;